import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:im_demo/app/modules/auth_test/views/auth_test_view.dart';
import 'package:im_demo/app/modules/chat/views/chat_view.dart';
import 'package:im_demo/app/modules/create_group/views/create_group_view.dart';
import 'package:im_demo/app/modules/group_chat_protobuf/views/group_chat_protobuf_view.dart';
import 'package:im_demo/app/modules/invite_group/views/invite_group_view.dart';
import 'package:im_demo/app/modules/login/views/login_view.dart';
import 'package:im_demo/app/modules/proxy_setting/views/proxy_setting_view.dart';
import 'package:im_demo/app/modules/register/views/register_view.dart';
import 'package:im_demo/app/modules/single_chat/views/single_chat_view.dart';
import 'package:im_demo/app/modules/single_chat_protobuf/views/single_chat_protobuf_view.dart';
import 'package:im_demo/app/modules/test/views/test_view.dart';

import '../../../../utils/logger_util.dart';
import '../../chat_2/views/chat_2_view.dart';
import '../../group_chat/views/group_chat_view.dart';
import '../controllers/home_controller.dart';

class HomeView extends GetView<HomeController> {
  const HomeView({super.key});

  @override
  Widget build(BuildContext context) {
    final controller = Get.put(HomeController());

    return Scaffold(
      appBar: AppBar(title: const Text('Home'), centerTitle: true),

      // body: Center(
      //   child: Container(
      //     padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 8.0),
      //     // width: double.infinity,
      //     child: Column(
      //       // mainAxisSize: MainAxisSize.max,
      //       // crossAxisAlignment: CrossAxisAlignment.stretch,
      //       children: [
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(ChatView());
      //           },
      //           onLongPress: () {
      //             logE('onLongPress');
      //           },
      //           child: Text('Chat'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(Chat2View());
      //           },
      //           child: Text('Chat2'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(SingleChatView());
      //           },
      //           child: Text('SingleChat'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(GroupChatView());
      //           },
      //           child: Text('GroupChat'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(SingleChatProtobufView());
      //           },
      //           child: Text('SingleChatProtobuf'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(GroupChatProtobufView());
      //           },
      //           child: Text('GroupChatProtobuf'),
      //         ),
      //         SizedBox(height: 8.0),
      //         ElevatedButton(
      //           onPressed: () {
      //             Get.to(TestView());
      //           },
      //           child: Text('Test'),
      //         ),
      //       ],
      //     ),
      //   ),
      // ),
      body: SingleChildScrollView(
        padding: EdgeInsets.all(16.0),
        child: Center(
          child: SizedBox(
            width: double.infinity,
            child: Column(
              // mainAxisSize: MainAxisSize.max,
              // crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                ElevatedButton(
                  onPressed: () {
                    Get.to(ChatView());
                  },
                  onLongPress: () {
                    logE('onLongPress');
                  },
                  child: Text('Chat'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(Chat2View());
                  },
                  child: Text('Chat2'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(ProxySettingView());
                  },
                  child: Text('ProxySetting'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(SingleChatView());
                  },
                  child: Text('SingleChat'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(GroupChatView());
                  },
                  child: Text('GroupChat'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(SingleChatProtobufView());
                  },
                  child: Text('SingleChatProtobuf'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(GroupChatProtobufView());
                  },
                  child: Text('GroupChatProtobuf'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(RegisterView());
                  },
                  child: Text('Register'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(CreateGroupView());
                  },
                  child: Text('CreateGroup'),
                ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(InviteGroupView());
                  },
                  child: Text('InviteGroup'),
                ),
                // ElevatedButton(
                //   onPressed: () {
                //     controller.testPost();
                //   },
                //   child: Text('HttpRequest'),
                // ),
                SizedBox(height: 8.0),
                ElevatedButton(
                  onPressed: () {
                    Get.to(LoginView());
                  },
                  child: Text('Login'),
                ),
                // SizedBox(height: 8.0),
                // ElevatedButton(
                //   onPressed: () {
                //     Get.to(AuthTestView());
                //   },
                //   child: Text('Auth'),
                // ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
